package com.nervous.jiaoli.user.user.dao;

import com.nervous.jiaoli.face.tag.TagDto;
import com.nervous.jiaoli.user.user.Report;
import com.nervous.jiaoli.user.user.User;
import com.nervous.jiaoli.user.user.UserDto;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

public interface UserDao {

    @Select("select * from t_user")
    List<User> findUserList();

    @Select("select lpad(ifnull(max(convert(substring(u_id from 10),unsigned)),0)+1,4,'0') from t_user where u_id like concat(#{prefix},'%')")
    String findUserNewNum(String prefix);

    List<User> findUserListByCondition(UserDto userDto);

    @Insert("insert into t_user(u_id,u_pwd,u_name,u_sex,u_avatar,u_birth) values(#{u_id},#{u_pwd},#{u_name},#{u_sex},#{u_avatar},#{u_birth})")
    void addUser(UserDto userDto);

    void delUser(UserDto userDto);


    void updateUser(UserDto userDto);

    Report findCountUser();

}
